CREATE TABLE jmd_dm.dm_end_center_error_scan_cnt_dt (
                                                        center_code varchar(50) NULL COMMENT "中心编码",
                                                        agent_code varchar(50) NULL COMMENT "代理区code",
                                                        ordersource_name varchar(100) NULL COMMENT "订单来源",
                                                        date_time date NULL COMMENT "查询时间",
                                                        center_name varchar(100) NULL COMMENT "中心名称",
                                                        agent_name varchar(100) NULL COMMENT "代理区",
                                                        error_cnt int(11) NULL COMMENT "错分量",
                                                        operate_cnt int(11) NULL COMMENT "操作量",
                                                        second_exception int(11) NULL COMMENT "二段码异常",
                                                        up_bagging_exception int(11) NULL COMMENT "上环节建包异常",
                                                        equipment_exception int(11) NULL COMMENT "设备异常",
                                                        return_cnt int(11) NULL COMMENT "退回件",
                                                        send_on int(11) NULL COMMENT "转寄件",
                                                        delete_scan int(11) NULL COMMENT "扫描删除",
                                                        human_factor int(11) NULL COMMENT "人为因素",
                                                        virt_code varchar(50) NULL COMMENT "虚拟代理区code",
                                                        virt_name varchar(100) NULL COMMENT "虚拟代理区name",
                                                        provider_id varchar(50) NULL COMMENT "省份id",
                                                        provider_name varchar(100) NULL COMMENT "省份name"
) ENGINE=OLAP
DUPLICATE KEY(center_code, agent_code, ordersource_name)
COMMENT "错分率-汇总"
PARTITION BY RANGE(date_time)(
   START ("2023-06-30") END ("2023-07-10") EVERY (INTERVAL 1 day))
DISTRIBUTED BY HASH(ordersource_name) BUCKETS 2
PROPERTIES (
"replication_num" = "3",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-180",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "2",
"in_memory" = "false",
"storage_format" = "V2"
);

alter table jms_dm.dm_end_center_error_scan_cnt_dt
    add columns(
    error_load int comment '错装',
    no_send_code int  comment '无无二段码',
    no_dispatch_code int  comment '二段码无目的网点'
    )cascade